package com.szrt.java.day20170111.ch03;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.junit.Test;

public class SimpleDateFormatTest {
	
	@Test
	public void simpleDateFormatTest() throws Exception {
		
		
		//2017-01-12 09:04:23
		//SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss :w");
		DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Date date = new Date();
		
		String time = sdf.format(date);
		
		System.out.println(time);
		
	}
	@Test
	public void simpleDateFormatTest2() throws Exception {
		
		
		//2017-01-12 09:04:23
		//SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss :w");
		//DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		DateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
		//String ss="2017-01-11 09:04:23";
		String ss="20170111090423234";
		
		
		//把字符串转化成
		Date dd  =df.parse(ss);
		
		
		Date now = new Date();
		
		System.out.println(now.after(dd));
		//System.out.println();
	
		
	}

}
